package day0227;

public class Demo03 {

    public static void main(String[] args) {
        String str = "云创动力";
        String str1 = "云创动力";
        System.out.println("str.equals(str1) --> " + str.equals(str1)); //true
        System.out.println("str == str1 --> " + (str == str1)); //true

        // 两个字符串字面量拼接，编译时会直接将 值 计算出来
        String str3 = "云创" + "动力";
        System.out.println("str.equals(str3) --> " + str.equals(str3)); //true
        System.out.println("str == str3 --> " + (str == str3));  //true

        System.out.println("==========");
        String str4 = "云创";
        String str5 = "动力";

        String str6 = str4 + str5;
        System.out.println("str.equals(str6) --> " + str.equals(str6)); //true
        System.out.println("(str == str6) --> " + (str == str6)); //false


        System.out.println("================");
        String str7 = "云创" + str5;
        String str8 = str4 + "动力";
        System.out.println("str7 == str8 --> " + (str7 == str8)); //false
        System.out.println("str == str7 -->" + (str == str7)); //false
        System.out.println("str == str8 --> "+ (str == str8));//false
        System.out.println("str6 == str7 --> " + (str6 == str7));//false

        String str9 = "云创" + str5;
        System.out.println(str7 == str9);

        System.out.println("================");
        String s = new String("云创动力");
        String s1 = new String("云创动力");

        System.out.println("=============");
        System.out.println(s.equals(str)); //true
        System.out.println(s.equals(s1)); //true
        System.out.println((s == str)); //false
        System.out.println((s == s1)); //false

    }
}
